<?
switch ($_GET['action'])
{
	case "update" :
		$_SESSION['test'].=$_REQUEST['name']."<br/>";
	case "show":
		echo $_SESSION['test'];
		break;
	default:
?>



<script type="text/javascript" charset="utf-8">


$(function() {
  $('.error').hide();
  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#FFDDAA"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  var name = $("input#name").val();
		if (name == "") {
      $("label#name_error").show();
      $("input#name").focus();
      return false;
    }
		var email = $("input#email").val();
		if (email == "") {
      $("label#email_error").show();
      $("input#email").focus();
      return false;
    }
		var phone = $("input#phone").val();
		if (phone == "") {
      $("label#phone_error").show();
      $("input#phone").focus();
      return false;
    }
		
		var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "test?action=update",
      data: dataString,
      success: function() {
     	
        $('#contact_form').html("<div id='message'></div>");
        $('#message').html("<h2>מעדכן נתונים.. אנא המתן</h2>")
        .hide()
        .fadeIn(1500, function() {
         disablePopup();
		$("#result").load("test?action=show&notemplate=true");
        });
      }
     });
    return false;
	});
});
runOnLoad(function(){
  $("input#name").select().focus();
});

	</script>
		<h1><?=TITLE;?></h1>

		<p id="contactArea">
		<div id="contact_form">  
  <div id="contact_form">
  <form name="contact" action="">
    <fieldset>
      <label for="name" id="name_label">שדה שמתעדכן : </label>
      <input type="text" name="name" id="name" size="30" value="" class="text-input" />
      <label class="error" for="name" id="name_error">This field is required.</label>
      <br/>
      <label for="email" id="email_label">שדה נוסף : </label>
      <input type="text" name="email" id="email" size="30" value="" class="text-input" />
      <label class="error" for="email" id="email_error">This field is required.</label>
      <br/>
      <label for="phone" id="phone_label">שדה נוסף : </label>
      <input type="text" name="phone" id="phone" size="30" value="" class="text-input" />
      <label class="error" for="phone" id="phone_error">This field is required.</label>
      
    	<br />
      <input type="submit" name="submit" class="button" id="submit_btn" value="Send" />
    </fieldset>
  </form>
  </div>
  
		
<?
	break;
}

?>